#include "higmac.h"
#include "phy_fix.h"

static const u32 phy_fix_param[] = {
	0x33f9,0xbd,
	0x33fa,0x34,
	0x33fb,0x00,
	0x33fc,0x39,
	0x3400,0x39,
	0x3401,0xCC,
	0x3402,0x10,
	0x3403,0x0A,
	0x3404,0xFD,
	0x3405,0xFF,
	0x3406,0xF0,
	0x3407,0xF6,
	0x3408,0x38,
	0x3409,0x21,
	0x340A,0x26,
	0x340B,0x40,
	0x340C,0xC6,
	0x340D,0x01,
	0x340E,0xF7,
	0x340F,0x38,
	0x3410,0x21,
	0x3411,0xC6,
	0x3412,0xB0,
	0x3413,0xF7,
	0x3414,0x01,
	0x3415,0xFE,
	0x3416,0xC6,
	0x3417,0x0F,
	0x3418,0xF7,
	0x3419,0x01,
	0x341A,0xFF,
	0x341B,0x5C,
	0x341C,0xF7,
	0x341D,0x02,
	0x341E,0x00,
	0x341F,0xCC,
	0x3420,0x36,
	0x3421,0x91,
	0x3422,0xFD,
	0x3423,0x00,
	0x3424,0xD1,
	0x3425,0x7F,
	0x3426,0x01,
	0x3427,0xC0,
	0x3428,0xCC,
	0x3429,0x37,
	0x342A,0xD1,
	0x342B,0xFD,
	0x342C,0x00,
	0x342D,0xD3,
	0x342E,0x7F,
	0x342F,0x01,
	0x3430,0xBF,
	0x3431,0xCC,
	0x3432,0x34,
	0x3433,0x9C,
	0x3434,0xFD,
	0x3435,0x01,
	0x3436,0xD6,
	0x3437,0xCC,
	0x3438,0x34,
	0x3439,0x4D,
	0x343A,0xFD,
	0x343B,0x30,
	0x343C,0x30,
	0x343D,0xC6,
	0x343E,0x0A,
	0x343F,0xF7,
	0x3440,0x31,
	0x3441,0x4A,
	0x3442,0xC6,
	0x3443,0xE0,
	0x3444,0xF7,
	0x3445,0x00,
	0x3446,0x7C,
	0x3447,0xC6,
	0x3448,0x54,
	0x3449,0xF7,
	0x344A,0x01,
	0x344B,0xEE,
	0x344C,0x39,
	0x344D,0xC6,
	0x344E,0x77,
	0x344F,0xF7,
	0x3450,0x1C,
	0x3451,0xAB,
	0x3452,0xC6,
	0x3453,0x84,
	0x3454,0xF7,
	0x3455,0x1C,
	0x3456,0xA9,
	0x3457,0xC6,
	0x3458,0x08,
	0x3459,0xF7,
	0x345A,0x1C,
	0x345B,0xAA,
	0x345C,0xC6,
	0x345D,0x80,
	0x345E,0xF7,
	0x345F,0x1C,
	0x3460,0xAC,
	0x3461,0xC6,
	0x3462,0xEE,
	0x3463,0xF7,
	0x3464,0x1C,
	0x3465,0xAE,
	0x3466,0xC6,
	0x3467,0x01,
	0x3468,0xF7,
	0x3469,0x1C,
	0x346A,0xAF,
	0x346B,0xC6,
	0x346C,0xFF,
	0x346D,0xF7,
	0x346E,0x12,
	0x346F,0x90,
	0x3470,0xF7,
	0x3471,0x12,
	0x3472,0x91,
	0x3473,0xF7,
	0x3474,0x12,
	0x3475,0x92,
	0x3476,0xF7,
	0x3477,0x12,
	0x3478,0x93,
	0x3479,0xF7,
	0x347A,0x12,
	0x347B,0x94,
	0x347C,0xC6,
	0x347D,0x20,
	0x347E,0xF7,
	0x347F,0x1E,
	0x3480,0x0D,
	0x3481,0x7F,
	0x3482,0x12,
	0x3483,0x9E,
	0x3484,0xC6,
	0x3485,0xA2,
	0x3486,0xF7,
	0x3487,0x1C,
	0x3488,0xA9,
	0x3489,0x39,
	0x348A,0x18,
	0x348B,0xCE,
	0x348C,0x38,
	0x348D,0x1A,
	0x348E,0x18,
	0x348F,0x3A,
	0x3490,0xF6,
	0x3491,0x20,
	0x3492,0x09,
	0x3493,0xC4,
	0x3494,0xF0,
	0x3495,0x18,
	0x3496,0xEA,
	0x3497,0x00,
	0x3498,0xF7,
	0x3499,0x20,
	0x349A,0x09,
	0x349B,0x39,
	0x349C,0xF6,
	0x349D,0x01,
	0x349E,0xEC,
	0x349F,0x27,
	0x34A0,0x68,
	0x34A1,0xF6,
	0x34A2,0x20,
	0x34A3,0x09,
	0x34A4,0xC4,
	0x34A5,0x0F,
	0x34A6,0xF7,
	0x34A7,0x01,
	0x34A8,0xE4,
	0x34A9,0xF6,
	0x34AA,0x1C,
	0x34AB,0xC2,
	0x34AC,0xC1,
	0x34AD,0x7F,
	0x34AE,0x23,
	0x34AF,0x0B,
	0x34B0,0xF6,
	0x34B1,0x1C,
	0x34B2,0xC2,
	0x34B3,0xC1,
	0x34B4,0x90,
	0x34B5,0x24,
	0x34B6,0x04,
	0x34B7,0xC6,
	0x34B8,0x01,
	0x34B9,0x20,
	0x34BA,0x2D,
	0x34BB,0xF6,
	0x34BC,0x1C,
	0x34BD,0xC2,
	0x34BE,0xC1,
	0x34BF,0x90,
	0x34C0,0x25,
	0x34C1,0x0B,
	0x34C2,0xF6,
	0x34C3,0x1C,
	0x34C4,0xC2,
	0x34C5,0xC1,
	0x34C6,0xA0,
	0x34C7,0x24,
	0x34C8,0x04,
	0x34C9,0xC6,
	0x34CA,0x02,
	0x34CB,0x20,
	0x34CC,0x1B,
	0x34CD,0xF6,
	0x34CE,0x1C,
	0x34CF,0xC2,
	0x34D0,0xC1,
	0x34D1,0xA0,
	0x34D2,0x25,
	0x34D3,0x0B,
	0x34D4,0xF6,
	0x34D5,0x1C,
	0x34D6,0xC2,
	0x34D7,0xC1,
	0x34D8,0xD0,
	0x34D9,0x24,
	0x34DA,0x04,
	0x34DB,0xC6,
	0x34DC,0x03,
	0x34DD,0x20,
	0x34DE,0x09,
	0x34DF,0xF6,
	0x34E0,0x1C,
	0x34E1,0xC2,
	0x34E2,0xC1,
	0x34E3,0xD0,
	0x34E4,0x25,
	0x34E5,0x04,
	0x34E6,0xC6,
	0x34E7,0x04,
	0x34E8,0x8D,
	0x34E9,0xA0,
	0x34EA,0xF6,
	0x34EB,0x20,
	0x34EC,0x09,
	0x34ED,0xC4,
	0x34EE,0x0F,
	0x34EF,0xF7,
	0x34F0,0x01,
	0x34F1,0xEB,
	0x34F2,0x7A,
	0x34F3,0x01,
	0x34F4,0xEC,
	0x34F5,0xF6,
	0x34F6,0x01,
	0x34F7,0xE4,
	0x34F8,0xF1,
	0x34F9,0x01,
	0x34FA,0xEB,
	0x34FB,0x27,
	0x34FC,0x0C,
	0x34FD,0xC6,
	0x34FE,0x01,
	0x34FF,0x37,
	0x3500,0xC6,
	0x3501,0x51,
	0x3502,0xBD,
	0x3503,0xD3,
	0x3504,0xDF,
	0x3505,0x31,
	0x3506,0xC6,
	0x3507,0x01,
	0x3508,0x39,
	0x3509,0x5F,
	0x350A,0x39,
	0x350B,0x3C,
	0x350C,0xF6,
	0x350D,0x00,
	0x350E,0x46,
	0x350F,0x4F,
	0x3510,0xC4,
	0x3511,0x0C,
	0x3512,0x83,
	0x3513,0x00,
	0x3514,0x08,
	0x3515,0x27,
	0x3516,0x07,
	0x3517,0xC6,
	0x3518,0x11,
	0x3519,0xF7,
	0x351A,0x01,
	0x351B,0xC0,
	0x351C,0x38,
	0x351D,0x39,
	0x351E,0xF6,
	0x351F,0x02,
	0x3520,0x01,
	0x3521,0x26,
	0x3522,0x33,
	0x3523,0xF6,
	0x3524,0x01,
	0x3525,0xF8,
	0x3526,0xC1,
	0x3527,0x05,
	0x3528,0x24,
	0x3529,0x27,
	0x352A,0xC6,
	0x352B,0x51,
	0x352C,0xBD,
	0x352D,0xD4,
	0x352E,0x7F,
	0x352F,0x5D,
	0x3530,0x26,
	0x3531,0x02,
	0x3532,0x38,
	0x3533,0x39,
	0x3534,0xF6,
	0x3535,0x1C,
	0x3536,0xC5,
	0x3537,0xC5,
	0x3538,0x01,
	0x3539,0x27,
	0x353A,0x08,
	0x353B,0xF6,
	0x353C,0x1C,
	0x353D,0xC2,
	0x353E,0xC0,
	0x353F,0x10,
	0x3540,0xF7,
	0x3541,0x1C,
	0x3542,0xC2,
	0x3543,0x7C,
	0x3544,0x01,
	0x3545,0xF8,
	0x3546,0xC6,
	0x3547,0x01,
	0x3548,0x37,
	0x3549,0xC6,
	0x354A,0x51,
	0x354B,0xBD,
	0x354C,0xD3,
	0x354D,0xDF,
	0x354E,0x31,
	0x354F,0x38,
	0x3550,0x39,
	0x3551,0xC6,
	0x3552,0x01,
	0x3553,0xF7,
	0x3554,0x02,
	0x3555,0x01,
	0x3556,0xC1,
	0x3557,0x01,
	0x3558,0x26,
	0x3559,0x3B,
	0x355A,0xF6,
	0x355B,0x10,
	0x355C,0xC2,
	0x355D,0xC5,
	0x355E,0x01,
	0x355F,0x27,
	0x3560,0x0D,
	0x3561,0xBD,
	0x3562,0x97,
	0x3563,0xC4,
	0x3564,0x7C,
	0x3565,0x00,
	0x3566,0x54,
	0x3567,0xC6,
	0x3568,0x03,
	0x3569,0xF7,
	0x356A,0x02,
	0x356B,0x01,
	0x356C,0x38,
	0x356D,0x39,
	0x356E,0xF6,
	0x356F,0x12,
	0x3570,0x22,
	0x3571,0xCA,
	0x3572,0x04,
	0x3573,0xF7,
	0x3574,0x12,
	0x3575,0x22,
	0x3576,0xF6,
	0x3577,0x12,
	0x3578,0x22,
	0x3579,0xC4,
	0x357A,0xFB,
	0x357B,0xF7,
	0x357C,0x12,
	0x357D,0x22,
	0x357E,0xF6,
	0x357F,0x12,
	0x3580,0x41,
	0x3581,0xCA,
	0x3582,0x01,
	0x3583,0xF7,
	0x3584,0x12,
	0x3585,0x41,
	0x3586,0xF6,
	0x3587,0x12,
	0x3588,0x41,
	0x3589,0xC4,
	0x358A,0xFE,
	0x358B,0xF7,
	0x358C,0x12,
	0x358D,0x41,
	0x358E,0xC6,
	0x358F,0x02,
	0x3590,0xF7,
	0x3591,0x02,
	0x3592,0x01,
	0x3593,0x38,
	0x3594,0x39,
	0x3595,0xC1,
	0x3596,0x02,
	0x3597,0x26,
	0x3598,0x1D,
	0x3599,0xF6,
	0x359A,0x12,
	0x359B,0x20,
	0x359C,0xC4,
	0x359D,0x3F,
	0x359E,0xC1,
	0x359F,0x3A,
	0x35A0,0x26,
	0x35A1,0x0D,
	0x35A2,0xBD,
	0x35A3,0x97,
	0x35A4,0xC4,
	0x35A5,0x7C,
	0x35A6,0x00,
	0x35A7,0x54,
	0x35A8,0xC6,
	0x35A9,0x03,
	0x35AA,0xF7,
	0x35AB,0x02,
	0x35AC,0x01,
	0x35AD,0x20,
	0x35AE,0x07,
	0x35AF,0xC6,
	0x35B0,0x03,
	0x35B1,0xF7,
	0x35B2,0x01,
	0x35B3,0xC0,
	0x35B4,0x38,
	0x35B5,0x39,
	0x35B6,0xC1,
	0x35B7,0x03,
	0x35B8,0x26,
	0x35B9,0x60,
	0x35BA,0xF6,
	0x35BB,0x01,
	0x35BC,0xF3,
	0x35BD,0x4F,
	0x35BE,0xC4,
	0x35BF,0x02,
	0x35C0,0x4D,
	0x35C1,0xC5,
	0x35C2,0x02,
	0x35C3,0x27,
	0x35C4,0x0F,
	0x35C5,0xF6,
	0x35C6,0x01,
	0x35C7,0xF3,
	0x35C8,0xC4,
	0x35C9,0x7D,
	0x35CA,0xF7,
	0x35CB,0x01,
	0x35CC,0xF3,
	0x35CD,0xC6,
	0x35CE,0x03,
	0x35CF,0xF7,
	0x35D0,0x01,
	0x35D1,0xC0,
	0x35D2,0x38,
	0x35D3,0x39,
	0x35D4,0x13,
	0x35D5,0x24,
	0x35D6,0x08,
	0x35D7,0x02,
	0x35D8,0x38,
	0x35D9,0x39,
	0x35DA,0xF6,
	0x35DB,0x10,
	0x35DC,0xC2,
	0x35DD,0xC5,
	0x35DE,0x01,
	0x35DF,0x27,
	0x35E0,0x02,
	0x35E1,0x38,
	0x35E2,0x39,
	0x35E3,0xF6,
	0x35E4,0x1C,
	0x35E5,0x82,
	0x35E6,0xF1,
	0x35E7,0x00,
	0x35E8,0xEC,
	0x35E9,0x22,
	0x35EA,0x10,
	0x35EB,0xFE,
	0x35EC,0x01,
	0x35ED,0x44,
	0x35EE,0xAD,
	0x35EF,0x00,
	0x35F0,0xF6,
	0x35F1,0x12,
	0x35F2,0x20,
	0x35F3,0xC4,
	0x35F4,0x3F,
	0x35F5,0xC1,
	0x35F6,0x3A,
	0x35F7,0x26,
	0x35F8,0x03,
	0x35F9,0x38,
	0x35FA,0x39,
	0x35FB,0x01,
	0x35FC,0xF6,
	0x35FD,0x31,
	0x35FE,0x45,
	0x35FF,0x5A,
	0x3600,0x26,
	0x3601,0x0E,
	0x3602,0xF6,
	0x3603,0x30,
	0x3604,0x61,
	0x3605,0x37,
	0x3606,0xC6,
	0x3607,0x52,
	0x3608,0xBD,
	0x3609,0xD3,
	0x360A,0xDF,
	0x360B,0x31,
	0x360C,0xC6,
	0x360D,0x10,
	0x360E,0x20,
	0x360F,0x05,
	0x3610,0xBD,
	0x3611,0x97,
	0x3612,0xD3,
	0x3613,0xC6,
	0x3614,0x03,
	0x3615,0xF7,
	0x3616,0x01,
	0x3617,0xC0,
	0x3618,0x38,
	0x3619,0x39,
	0x361A,0x38,
	0x361B,0x39,
	0x361C,0x3C,
	0x361D,0xFE,
	0x361E,0x01,
	0x361F,0x42,
	0x3620,0xAD,
	0x3621,0x00,
	0x3622,0xC6,
	0x3623,0x01,
	0x3624,0xF7,
	0x3625,0x10,
	0x3626,0xF5,
	0x3627,0xF7,
	0x3628,0x12,
	0x3629,0xF5,
	0x362A,0xFE,
	0x362B,0x30,
	0x362C,0x30,
	0x362D,0xAD,
	0x362E,0x00,
	0x362F,0xBD,
	0x3630,0xBB,
	0x3631,0x52,
	0x3632,0xC6,
	0x3633,0x90,
	0x3634,0xF7,
	0x3635,0x1C,
	0x3636,0xC0,
	0x3637,0xBD,
	0x3638,0x9A,
	0x3639,0xD9,
	0x363A,0xC6,
	0x363B,0x01,
	0x363C,0x37,
	0x363D,0xC6,
	0x363E,0x51,
	0x363F,0xBD,
	0x3640,0xD3,
	0x3641,0xDF,
	0x3642,0x31,
	0x3643,0xC6,
	0x3644,0x0E,
	0x3645,0xF7,
	0x3646,0x01,
	0x3647,0xC0,
	0x3648,0x38,
	0x3649,0x39,
	0x364A,0x3C,
	0x364B,0xC6,
	0x364C,0x52,
	0x364D,0xBD,
	0x364E,0xD4,
	0x364F,0x7F,
	0x3650,0x5D,
	0x3651,0x27,
	0x3652,0x03,
	0x3653,0xBD,
	0x3654,0xBB,
	0x3655,0x52,
	0x3656,0xF6,
	0x3657,0x00,
	0x3658,0x46,
	0x3659,0xC5,
	0x365A,0x0C,
	0x365B,0x26,
	0x365C,0x07,
	0x365D,0xC6,
	0x365E,0x11,
	0x365F,0xF7,
	0x3660,0x01,
	0x3661,0xC0,
	0x3662,0x38,
	0x3663,0x39,
	0x3664,0xC6,
	0x3665,0x51,
	0x3666,0xBD,
	0x3667,0xD4,
	0x3668,0x7F,
	0x3669,0x5D,
	0x366A,0x26,
	0x366B,0x02,
	0x366C,0x38,
	0x366D,0x39,
	0x366E,0xFE,
	0x366F,0x01,
	0x3670,0xD6,
	0x3671,0xAD,
	0x3672,0x00,
	0x3673,0x5D,
	0x3674,0x27,
	0x3675,0x02,
	0x3676,0x38,
	0x3677,0x39,
	0x3678,0xFC,
	0x3679,0x30,
	0x367A,0x0E,
	0x367B,0xBD,
	0x367C,0x8F,
	0x367D,0xEE,
	0x367E,0xBD,
	0x367F,0x9A,
	0x3680,0xD9,
	0x3681,0xC6,
	0x3682,0x02,
	0x3683,0x37,
	0x3684,0xC6,
	0x3685,0x51,
	0x3686,0xBD,
	0x3687,0xD3,
	0x3688,0xDF,
	0x3689,0x31,
	0x368A,0xC6,
	0x368B,0x08,
	0x368C,0xF7,
	0x368D,0x01,
	0x368E,0xC0,
	0x368F,0x38,
	0x3690,0x39,
	0x3691,0x3C,
	0x3692,0x34,
	0x3693,0x30,
	0x3694,0xF6,
	0x3695,0x01,
	0x3696,0xC0,
	0x3697,0xC1,
	0x3698,0x13,
	0x3699,0x25,
	0x369A,0x03,
	0x369B,0x7E,
	0x369C,0x37,
	0x369D,0x93,
	0x369E,0xBD,
	0x369F,0xEE,
	0x36A0,0x8F,
	0x36A1,0x36,
	0x36A2,0xCA,
	0x36A3,0x36,
	0x36A4,0xCD,
	0x36A5,0x37,
	0x36A6,0x08,
	0x36A7,0x37,
	0x36A8,0x0E,
	0x36A9,0x37,
	0x36AA,0x14,
	0x36AB,0x37,
	0x36AC,0x20,
	0x36AD,0x37,
	0x36AE,0x25,
	0x36AF,0x37,
	0x36B0,0x33,
	0x36B1,0x37,
	0x36B2,0x38,
	0x36B3,0x37,
	0x36B4,0x3D,
	0x36B5,0x37,
	0x36B6,0x42,
	0x36B7,0x37,
	0x36B8,0x45,
	0x36B9,0x37,
	0x36BA,0x4A,
	0x36BB,0x37,
	0x36BC,0x4F,
	0x36BD,0x37,
	0x36BE,0x64,
	0x36BF,0x37,
	0x36C0,0x6C,
	0x36C1,0x37,
	0x36C2,0x71,
	0x36C3,0x37,
	0x36C4,0x76,
	0x36C5,0x37,
	0x36C6,0x79,
	0x36C7,0x7E,
	0x36C8,0x37,
	0x36C9,0x93,
	0x36CA,0xBD,
	0x36CB,0xBC,
	0x36CC,0x25,
	0x36CD,0xF6,
	0x36CE,0x00,
	0x36CF,0x46,
	0x36D0,0x4F,
	0x36D1,0xC4,
	0x36D2,0x0C,
	0x36D3,0x83,
	0x36D4,0x00,
	0x36D5,0x08,
	0x36D6,0x26,
	0x36D7,0xEF,
	0x36D8,0xBD,
	0x36D9,0xBC,
	0x36DA,0x33,
	0x36DB,0xF6,
	0x36DC,0x01,
	0x36DD,0xFF,
	0x36DE,0xF7,
	0x36DF,0x20,
	0x36E0,0xA5,
	0x36E1,0xC6,
	0x36E2,0x08,
	0x36E3,0xF7,
	0x36E4,0x20,
	0x36E5,0xA8,
	0x36E6,0xF6,
	0x36E7,0x30,
	0x36E8,0x54,
	0x36E9,0xFB,
	0x36EA,0x31,
	0x36EB,0x4A,
	0x36EC,0xE7,
	0x36ED,0x00,
	0x36EE,0xC1,
	0x36EF,0x3F,
	0x36F0,0x23,
	0x36F1,0x02,
	0x36F2,0xC6,
	0x36F3,0x3F,
	0x36F4,0x18,
	0x36F5,0xFE,
	0x36F6,0x30,
	0x36F7,0x4A,
	0x36F8,0x18,
	0x36F9,0x3A,
	0x36FA,0xF6,
	0x36FB,0x20,
	0x36FC,0xAA,
	0x36FD,0xC4,
	0x36FE,0xE0,
	0x36FF,0x18,
	0x3700,0xEA,
	0x3701,0x00,
	0x3702,0xF7,
	0x3703,0x20,
	0x3704,0xAA,
	0x3705,0x7E,
	0x3706,0x37,
	0x3707,0x93,
	0x3708,0xBD,
	0x3709,0xBC,
	0x370A,0x71,
	0x370B,0x7E,
	0x370C,0x37,
	0x370D,0x93,
	0x370E,0xBD,
	0x370F,0xBC,
	0x3710,0x94,
	0x3711,0x7E,
	0x3712,0x37,
	0x3713,0x93,
	0x3714,0xBD,
	0x3715,0xBD,
	0x3716,0x07,
	0x3717,0xC6,
	0x3718,0x02,
	0x3719,0x37,
	0x371A,0xC6,
	0x371B,0x51,
	0x371C,0xBD,
	0x371D,0xD3,
	0x371E,0xDF,
	0x371F,0x31,
	0x3720,0xBD,
	0x3721,0xBD,
	0x3722,0x38,
	0x3723,0x20,
	0x3724,0x6E,
	0x3725,0xBD,
	0x3726,0xBD,
	0x3727,0x90,
	0x3728,0xC6,
	0x3729,0x02,
	0x372A,0x37,
	0x372B,0xC6,
	0x372C,0x51,
	0x372D,0xBD,
	0x372E,0xD3,
	0x372F,0xDF,
	0x3730,0x31,
	0x3731,0x20,
	0x3732,0x60,
	0x3733,0xBD,
	0x3734,0x36,
	0x3735,0x4A,
	0x3736,0x20,
	0x3737,0x5B,
	0x3738,0xBD,
	0x3739,0xBE,
	0x373A,0x07,
	0x373B,0x20,
	0x373C,0x56,
	0x373D,0xBD,
	0x373E,0xBE,
	0x373F,0x6A,
	0x3740,0x20,
	0x3741,0x51,
	0x3742,0xBD,
	0x3743,0xBE,
	0x3744,0xB0,
	0x3745,0xBD,
	0x3746,0xBF,
	0x3747,0x05,
	0x3748,0x20,
	0x3749,0x49,
	0x374A,0xBD,
	0x374B,0xC0,
	0x374C,0x60,
	0x374D,0x20,
	0x374E,0x44,
	0x374F,0xBD,
	0x3750,0x36,
	0x3751,0x1C,
	0x3752,0xF6,
	0x3753,0x01,
	0x3754,0xFE,
	0x3755,0xF7,
	0x3756,0x1C,
	0x3757,0xC0,
	0x3758,0xBD,
	0x3759,0x9A,
	0x375A,0xD9,
	0x375B,0xC6,
	0x375C,0x02,
	0x375D,0x37,
	0x375E,0xC6,
	0x375F,0x51,
	0x3760,0xBD,
	0x3761,0xD3,
	0x3762,0xDF,
	0x3763,0x31,
	0x3764,0xBD,
	0x3765,0xC0,
	0x3766,0xB2,
	0x3767,0x7F,
	0x3768,0x02,
	0x3769,0x01,
	0x376A,0x20,
	0x376B,0x27,
	0x376C,0xBD,
	0x376D,0x35,
	0x376E,0x0B,
	0x376F,0x20,
	0x3770,0x22,
	0x3771,0xBD,
	0x3772,0xC1,
	0x3773,0x7E,
	0x3774,0x20,
	0x3775,0x1D,
	0x3776,0xBD,
	0x3777,0xC1,
	0x3778,0x9F,
	0x3779,0x7F,
	0x377A,0x20,
	0x377B,0xA8,
	0x377C,0x18,
	0x377D,0xFE,
	0x377E,0x30,
	0x377F,0x4A,
	0x3780,0xF6,
	0x3781,0x30,
	0x3782,0x54,
	0x3783,0x18,
	0x3784,0x3A,
	0x3785,0xF6,
	0x3786,0x20,
	0x3787,0xAA,
	0x3788,0xC4,
	0x3789,0xE0,
	0x378A,0x18,
	0x378B,0xEA,
	0x378C,0x00,
	0x378D,0xF7,
	0x378E,0x20,
	0x378F,0xAA,
	0x3790,0xBD,
	0x3791,0xC1,
	0x3792,0xBF,
	0x3793,0x31,
	0x3794,0x38,
	0x3795,0x39,
	0x3796,0x3C,
	0x3797,0xF6,
	0x3798,0x00,
	0x3799,0x46,
	0x379A,0x4F,
	0x379B,0xC4,
	0x379C,0x03,
	0x379D,0x83,
	0x379E,0x00,
	0x379F,0x02,
	0x37A0,0x27,
	0x37A1,0x02,
	0x37A2,0x38,
	0x37A3,0x39,
	0x37A4,0xF6,
	0x37A5,0x00,
	0x37A6,0x47,
	0x37A7,0xC4,
	0x37A8,0xFC,
	0x37A9,0xCA,
	0x37AA,0x02,
	0x37AB,0xF7,
	0x37AC,0x00,
	0x37AD,0x47,
	0x37AE,0xFE,
	0x37AF,0x00,
	0x37B0,0xB5,
	0x37B1,0xAD,
	0x37B2,0x00,
	0x37B3,0xF6,
	0x37B4,0x02,
	0x37B5,0x00,
	0x37B6,0xF7,
	0x37B7,0x20,
	0x37B8,0xA5,
	0x37B9,0x13,
	0x37BA,0x00,
	0x37BB,0x10,
	0x37BC,0x03,
	0x37BD,0x7F,
	0x37BE,0x12,
	0x37BF,0x37,
	0x37C0,0xF6,
	0x37C1,0x01,
	0x37C2,0xEE,
	0x37C3,0xF7,
	0x37C4,0x12,
	0x37C5,0x36,
	0x37C6,0xC6,
	0x37C7,0x01,
	0x37C8,0xF7,
	0x37C9,0x12,
	0x37CA,0x51,
	0x37CB,0x5C,
	0x37CC,0xF7,
	0x37CD,0x01,
	0x37CE,0xBF,
	0x37CF,0x38,
	0x37D0,0x39,
	0x37D1,0xF6,
	0x37D2,0x01,
	0x37D3,0xBF,
	0x37D4,0xC1,
	0x37D5,0x0B,
	0x37D6,0x24,
	0x37D7,0x41,
	0x37D8,0xBD,
	0x37D9,0xEE,
	0x37DA,0x8F,
	0x37DB,0x37,
	0x37DC,0xF2,
	0x37DD,0x37,
	0x37DE,0xF5,
	0x37DF,0x37,
	0x37E0,0xF8,
	0x37E1,0x37,
	0x37E2,0xFB,
	0x37E3,0x38,
	0x37E4,0x03,
	0x37E5,0x38,
	0x37E6,0x07,
	0x37E7,0x38,
	0x37E8,0x0B,
	0x37E9,0x38,
	0x37EA,0x16,
	0x37EB,0x37,
	0x37EC,0xFF,
	0x37ED,0x38,
	0x37EE,0x0F,
	0x37EF,0x38,
	0x37F0,0x13,
	0x37F1,0x39,
	0x37F2,0xBD,
	0x37F3,0xC2,
	0x37F4,0x47,
	0x37F5,0x8D,
	0x37F6,0x9F,
	0x37F7,0x39,
	0x37F8,0xBD,
	0x37F9,0xC2,
	0x37FA,0x86,
	0x37FB,0xBD,
	0x37FC,0xC2,
	0x37FD,0xC0,
	0x37FE,0x39,
	0x37FF,0xBD,
	0x3800,0xC3,
	0x3801,0x40,
	0x3802,0x39,
	0x3803,0xBD,
	0x3804,0xC4,
	0x3805,0x07,
	0x3806,0x39,
	0x3807,0xBD,
	0x3808,0xC4,
	0x3809,0x45,
	0x380A,0x39,
	0x380B,0xBD,
	0x380C,0xC4,
	0x380D,0x98,
	0x380E,0x39,
	0x380F,0xBD,
	0x3810,0xC4,
	0x3811,0xF3,
	0x3812,0x39,
	0x3813,0xBD,
	0x3814,0xC5,
	0x3815,0x14,
	0x3816,0xBD,
	0x3817,0xC5,
	0x3818,0x2E,
	0x3819,0x39,
	0x381A,0x00,
	0x381B,0x04,
	0x381C,0x08,
	0x381D,0x09,
	0x381E,0x0D,
	0x381F,0x0E,
	0x3820,0x0F,
	0x3821,0x00,
	0x3400,0x01,
	0x33f8,0x01
};

int set_phy_expanded_access_mode(struct phy_device *phy_dev, int access_mode)
{
	int v, ret;

	v = phy_read(phy_dev, MII_MISC_CTL);
	v &= (~0x3);
	v |= (access_mode & 0x3);
	ret = phy_write(phy_dev, MII_MISC_CTL, v);

	return ret;
}

int phy_expanded_read(struct phy_device *phy_dev, u32 reg_addr)
{
	int v, ret;

	v = phy_read(phy_dev, MII_BMCR);
	v |= BMCR_PDOWN;
	phy_write(phy_dev, MII_BMCR, v);

	phy_write(phy_dev, MII_EXPMA, reg_addr);
	ret = phy_read(phy_dev, MII_EXPMD);

	v = phy_read(phy_dev, MII_BMCR);
	v &= (~BMCR_PDOWN);
	phy_write(phy_dev, MII_BMCR, v);

	return ret;
}

int phy_expanded_write(struct phy_device *phy_dev, u32 reg_addr, u16 val)
{
	int v, ret;

	v = phy_read(phy_dev, MII_BMCR);
	v |= BMCR_PDOWN;
	phy_write(phy_dev, MII_BMCR, v);

	phy_write(phy_dev, MII_EXPMA, reg_addr);
	ret = phy_write(phy_dev, MII_EXPMD, val);

	v = phy_read(phy_dev, MII_BMCR);
	v &= (~BMCR_PDOWN);
	phy_write(phy_dev, MII_BMCR, v);

	return ret;
}

int phy_expanded_write_bulk(struct phy_device *phy_dev, const u32 reg_and_val[],
			    int count)
{
	int i, v, ret = 0;
	u32 reg_addr;
	u16 val;

	v = phy_read(phy_dev, MII_BMCR);
	v |= BMCR_PDOWN;
	phy_write(phy_dev, MII_BMCR, v);

	for (i = 0; i < (2 * count); i += 2) {
		reg_addr = reg_and_val[i];
		val = (u16) reg_and_val[i + 1];
		phy_write(phy_dev, MII_EXPMA, reg_addr);
		ret = phy_write(phy_dev, MII_EXPMD, val);
	}

	v = phy_read(phy_dev, MII_BMCR);
	v &= (~BMCR_PDOWN);
	phy_write(phy_dev, MII_BMCR, v);

	return ret;
}

/* fix FEPHY for better eye diagram */
int hisilicon_fephy_fix(struct phy_device *phy_dev)
{
	int count;

	count = sizeof(phy_fix_param) / sizeof(phy_fix_param[0]);
	if (count % 2)
		pr_warn("internal FEPHY fix register count is not right.\n");
	count /= 2;

	phy_expanded_write_bulk(phy_dev, phy_fix_param, count);

	return 0;
}

/*
 * for a better Electromagnetic Compatibility
 */
int realtek_gephy_fix(struct phy_device *phy_dev)
{
#if 0
	int v;

	pr_info("RealTek phy fix: phy id=0x%x\n", phy_dev->phy_id);

	v = phy_read(phy_dev, 16);      /* PHYCR reg */
	v |= 1 << 4;                    /* clk125 remains at logic low */
	phy_write(phy_dev, 16, v);

	phy_write(phy_dev, 31, 0x0007);	/* set to extension page */
	phy_write(phy_dev, 30, 0x00A0);	/* set to extension page 160 */

	v = phy_read(phy_dev, 26);
	v &= ~(1 << 2);			/* enable RXC SSC */
	phy_write(phy_dev, 26, v);

	phy_write(phy_dev, 31, 0x0);	/* back to page 0 */

#endif

	return 0;
}

/* copy from phy_quirk() in hieth-sf/net.c */
int KSZ8051MNL_phy_fix(struct phy_device *phy_dev)
{
	u32 v;

	v = phy_read(phy_dev, 0x1F);
	v |= (1 << 7);       /* set phy RMII 50MHz clk; */
	phy_write(phy_dev, 0x1F, v);

	v = phy_read(phy_dev, 0x16);
	v |= (1 << 1);       /* set phy RMII override; */
	phy_write(phy_dev, 0x16, v);

	return 0;
}

/* copy from phy_quirk() in hieth-sf/net.c */
int KSZ8081RNB_phy_fix(struct phy_device *phy_dev)
{
	u32 v;

	v = phy_read(phy_dev, 0x1F);
	v |= (1 << 7);       /* set phy RMII 50MHz clk; */
	phy_write(phy_dev, 0x1F, v);

	return 0;
}

void phy_register_fixups(void)
{
	phy_register_fixup_for_uid(REALTEK_PHY_ID_8211EG,
			REALTEK_PHY_MASK, realtek_gephy_fix);
	phy_register_fixup_for_uid(HISILICON_PHY_ID_FESTAV200,
			HISILICON_PHY_MASK, hisilicon_fephy_fix);
	phy_register_fixup_for_uid(PHY_ID_KSZ8051MNL,
			DEFAULT_PHY_MASK, KSZ8051MNL_phy_fix);
	phy_register_fixup_for_uid(PHY_ID_KSZ8081RNB,
			DEFAULT_PHY_MASK, KSZ8081RNB_phy_fix);
}
